﻿/**
 * File:   aidl_defines.h
 * Author: AWTK Develop Team
 * Brief:  aidl 通用定义文件
 *
 * Copyright (c) 2018 - 2020  Guangzhou ZHIYUAN Electronics Co.,Ltd.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * License file for more details.
 *
 */

/**
 * History:
 * ================================================================
 * 2021-1-09 zhang zhongji <zhangzhongji@zlg.cn> created
 *
 */

#ifndef TK_AIDL_DEFINES_H
#define TK_AIDL_DEFINES_H

#include "tkc/types_def.h"
#include "tkc/str.h"
#include "tkc/slist.h"

BEGIN_C_DECLS

typedef struct _param_component_t {
  /**
   * @property {str_t} tag
   * @annotation ["readable"]
   * tag类型。
   */
  str_t tag;

  /**
   * @property {str_t} param_type
   * @annotation ["readable"]
   * 参数类型。
   */
  str_t param_type;

  /**
   * @property {str_t} param_name
   * @annotation ["readable"]
   * 参数名。
   */
  str_t param_name;

} param_component_t;

typedef struct _funtion_component_t {
  /**
   * @property {str_t} return_type
   * @annotation ["readable"]
   * 返回值类型。
   */
  str_t return_type;

  /**
   * @property {str_t} function_name
   * @annotation ["readable"]
   * 函数名。
   */
  str_t function_name;

  /**
   * @property {slist_t} param_list
   * @annotation ["readable"]
   * 参数列表。
   */
  slist_t* param_list;

} function_component_t;

typedef void (*package_converter_t)(void* ctx, const char* package_name);
typedef void (*import_converter_t)(void* ctx, const char* class_name);
typedef void (*interface_converter_t)(void* ctx, const char* interface_name, function_component_t* function_component);

typedef struct _builder_t{
    package_converter_t aidl_parser_on_package;
    import_converter_t aidl_parser_on_import;
    interface_converter_t aidl_parser_on_function;
    void* ctx;
} builder_t;

END_C_DECLS

#endif /*TK_AIDL_DEFINES_H*/
